<?php

include("KeyValueConn.php");

$SQ = "'";
$keyStr = "null";
$valStr = "null";
$error = "";
$sql_select = "SELECT `Key`, Val from keyval where `Key` = '$key' ";

if ($con)
{
	$ret = @mysql_select_db($table, $con);
	if($ret)
	{
		$result = @mysql_query($sql_select);
		if( $row = @mysql_fetch_array($result) )
		{
			$keyStr = $SQ . $row['Key'] . $SQ;
			$valStr = $row['Val'];
		}
		else
		{
			$error = ", 'error': 'No such key : $key' ";
		}
	}
	else
	{
		$error = ", 'error': 'No data table' ";
	}	
}
else
{
	$error = ", 'error': 'cannot connect DB', ";
}
@mysql_close($con);

echo "($callback)({'key' : $keyStr, 'val' : $valStr $error})"
?>